<html>
<head>
<style>
@media all { #test { color: green; } }
</style>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<div id="test"></div>
<script>
function getStyleSheetRules() {
  return document.styleSheets[0].rules;
}
description("Test that detached CSSOM subtrees keeps a reference to CSS stylesheets lacking wrappers.");

shouldBe('getStyleSheetRules().length', '1');
rule = getStyleSheetRules().item(0).cssRules[0];
debug("Removing &lt;style>...");
document.head.removeChild(document.getElementsByTagName("style")[0]);
shouldNotBe("rule.parentRule", "null");
</script>
</body>
</html>
